﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;
using Telerik.Web.UI;
using _WebShared.Classes;

namespace KPIS.GERP.GHRMS.APP.App_UI.UserControls
{
    public partial class DatePickerValidation : System.Web.UI.UserControl
    {
        private void Page_Load(object sender, EventArgs e)
        {

        }

        public void SetValue(object date)
        {
            switch (date.GetType().ToString())
            {
                case "System.DateTime":
                    txtDate.Value = ((DateTime)date).ToShortDateString();
                    break;
                case "System.String":
                default:
                    txtDate.Value = date.ToString();
                    break;
            }
        }

        public string GetStringValue()
        {
            string strDate = txtDate.Value;

            return strDate;
        }

        public DateTime GetDateValue()
        {
            string strDate = txtDate.Value;
            DateTime date = Convert.ToDateTime(strDate);

            return date;
        }
    }
}